package gspushmq.v1.consumer;

import gspushmq.model.TempRequestIdEnum;
import gspushmq.model.User;
import gspushmq.util.ToolsUtil;
import gspushmq.v1.consumer.core.PushCore;
import gspushmq.v1.subscribe.core.HandlerSubscribe;

import org.java_websocket.WebSocket;

import java.util.List;

/**
 * @Description 采用登录开子线程消费模式，加快未消费消息处理
 * @Author 成尚佳
 * @Date 2019/2/18 11:48
 * @Version 1.0
 * @company 上海朝阳永续信息技术有限公司
 * @copyright (c) 2015 SunTime Co'Ltd Inc. All rights reserved.
 **/
public class LoginUserThread  extends HandlerSubscribe {


    private User user;

    private WebSocket ws;

    /**
     *
     * 默认维护request和messageType的关系数组
     */
    private static List<String> mqSubs = TempRequestIdEnum.getMqSubTypes();


    public LoginUserThread(User user, WebSocket ws) {
        this.user = user;
        this.ws = ws;
    }

    public LoginUserThread(){
    }

	@Override
	public void doHandler() {
        PushCore.sendLoginUser(user,ws,mqSubs);
	}

	@Override
	public boolean valid() {
		return true;
	}

}
